<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="${pageContext.request.contextPath }/resource/js/jquery-2.min.js"></script>
<title>调理方案管理后台</title>
<style>
        	.soluDiv{
        		background-color: antiquewhite;
        		width:600px;
        		margin:0 auto;
        	}
        	.solubody{
        		background-color: #C0C0C0;
        	}
        	.textarea{
        		height: 80px;
        		width:590px;
        	}
        	#tendency{
        		width:590px;
        	}
        	#corporeity{
        		width: 80px;
        	}
        	#submit {
   			 	background-color: #4CAF50; /* Green */
    			border: none;
    			color: white;
    			padding: 15px 32px;
    			text-align: center;
    			text-decoration: none;
    			display: inline-block;
    			font-size: 16px;
    			margin: 4px 2px;
    			cursor: pointer;
    			border-radius: 8px;
			}
        </style>
</head>
<body class="solubody">
    	<div class="soluDiv" >
    		<form id="form" action="${pageContext.request.contextPath}/save" method="post">
    			<table>
    				<tr>
    					<td>体质表现：<textarea class="textarea"  id="performance" name="performance"></textarea></td>
    				</tr>
    				<tr>
    					<td>患病倾向：<textarea  id="tendency" name="tendency"></textarea></td>
    				</tr>
    				<tr>
    					<td>体&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;质：<select id="corporeity" name="corporeity">
    						 <option>气虚</option>
 							 <option>阴虚</option>
  							 <option>阳虚</option>
 							 <option>痰湿</option>
 							 <option>湿热</option>
 							 <option>气郁</option>
  							 <option>血瘀</option>
 							 <option>特禀</option>
 							 <option>平和</option>
    					</select></td>
    				</tr>
    				<tr>
    					<td>调理方案：<textarea  class="textarea"  id="toningSolutions" name="toningSolutions"></textarea><br></td>
    				</tr>
    				<tr>
    					<td>中医专家：<input type="text" id="doctor" name="doctor"/><br></td>
    				</tr>
    				<tr>
    					<td><input type="button" value="保存" id="submit"></td>
    				</tr>
    			</table>
    		</form>
    	</div>
    	<script type="text/javascript">
    	
    		/* var obj = window.dialogArguments;
    	    function test(){
    	    	 window.returnValue="返回值"
                 window.close();
    	    } */
    		$("#submit").click(function(){
    			
    			var performance = $("#performance").val();
        		var tendency = $("#tendency").val();
        		var toningSolutions = $("#toningSolutions").val();
        		var corporeity = $("#corporeity").val();
        		var doctor = $("#doctor").val();
        		
        		var data ={
        				"performance":performance,
        			    "tendency":tendency,
        				"toningSolutions":toningSolutions,
        				"corporeity":corporeity,
        				"doctor":doctor
        		         }
        		var jsonData=JSON.stringify(data);
        		
        		var url= "${pageContext.request.contextPath}/save.do";
        		 $.ajax({
         	    	type:'post',
         	   		url:url,
         	   		data:jsonData,
         	   	    contentType : "application/json", 
         	   		cache:false,
         	   		success:function(json){
         	   			alert("保存成功");
         	   		},
         	   	    error:function(){
         	   	    	alert("执行错误！");
         	   	    	//layer.msg("执行错误！", 8);
         	   	    }
         	   	});
        		 reset(); //清空表单
    		})
    		
    		function reset(){
    			$("#form")[0].reset();
    		}
    		
    	</script>
</body>
</html>